<?php

namespace App\Api\Validate;

class BaseValidate
{
    CONST ERROR_CODE = 10302;

    public function check($validator)
    {
        if ($validator->fails()) {
            $errors = $validator->errors();
            throw new \Exception($errors->first(), self::ERROR_CODE);
        }
    }

    public function return($message)
    {
        throw new \Exception($message, self::ERROR_CODE);
    }
}
